package models

import (
	"encoding/json"
	"time"
)

// CanvasMessage represents a persisted chat turn tied to a page version.
type CanvasMessage struct {
	ID              int64     `json:"id" db:"id"`
	VersionID       string    `json:"versionId" db:"version_id"`
	PromptRequestID *string   `json:"promptRequestId,omitempty" db:"prompt_request_id"`
	Author          string    `json:"author" db:"author"`
	Content         string    `json:"content" db:"content"`
	CreatedAt       time.Time `json:"createdAt" db:"created_at"`
}

// PageSection represents a structured segment within a page version.
type PageSection struct {
	ID            string          `json:"id" db:"id"`
	VersionID     string          `json:"versionId" db:"version_id"`
	SectionKey    string          `json:"sectionKey" db:"section_key"`
	Label         string          `json:"label" db:"label"`
	Description   string          `json:"description" db:"description"`
	Position      int             `json:"position" db:"position"`
	ComponentJSON json.RawMessage `json:"componentJson" db:"component_json"`
	CreatedAt     time.Time       `json:"createdAt" db:"created_at"`
}
